package heap;

public class HuffManTest {
    public static void main(String[] args) {
        // 仅仅这样创建，等价与声明了５个对象，但未调用构造函数
        // MyChar[] myChars = new MyChar[5];
        MyChar[] myChars = new MyChar[5];
        for (int i = 0; i < 5; i++) {
            myChars[i] = new MyChar();
        }
        myChars[0].setCh('a');
        myChars[0].setWeight(10);
        myChars[1].setCh('e');
        myChars[1].setWeight(5);
        myChars[2].setCh('g');
        myChars[2].setWeight(1);
        myChars[3].setCh('c');
        myChars[3].setWeight(4);
        myChars[4].setCh('u');
        myChars[4].setWeight(6);
        HuffManEncode huffManEncode = new HuffManEncode(myChars);
        System.out.println(huffManEncode.getEncode());
    }
}